package com.jl.commons.constant;

import sun.misc.BASE64Decoder;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class Constants {

    public static String CURRENT_USER = "loginUser";

    public static String SUCCESS = "success";

    public static String ID = "id";

    public static String CYCLE_TASK = "cycleTask";

    public static String WEEK_TDAYS_LENGTH_STR = "7";

    public static String DEFAULT_PASSWORD = "123456";

    public static String DEFAULT_SHOW_PASSWORD = "******";


    public static String KEY_WORD_STR_COLUMN = "key_word_id";

    public static String START_WORK_TIME = "9:00";

    public static Integer NORMAL_STATUS = 1;

    public static Integer IS_TEMP_TASK = 1;

    public static Integer NOT_TEMP_TASK = 0;

    public static Integer FAULT_TASK = 2;

    public static Long MAX_PAGE_SIZE = 99999L;

    public static Long FIRST_PAGE = 1L;

    public static Integer DUPLICATE_FAULT__TYPE_DEVICE_PART = 1;

    public static Integer DUPLICATE_FAULT__TYPE_SAME_SYMPTOM = 2;

    /**
     * 菜单类型 导航
     */
    public static Integer MENU_TYPE_NAVIGATION = 0;
    /**
     * 菜单类型 菜单
     */
    public static Integer MENU_TYPE_MENU = 1;
    /**
     * 菜单类型 功能
     */
    public static Integer MENU_TYPE_FUNCTION = 2;


    /**
     * 查询本台设备的故障信息
     */
    public static Integer DEVICE_FAULT_TYPE_OWN = 1;

    /**
     * 查询同类设备的故障信息
     */
    public static Integer DEVICE_FAULT__TYPE_SAME_MODEL = 2;

    public static String LIST_DIFFERENT_ADD = "add";

    public static String LIST_DIFFERENT_REDUCE = "reduce";

    public static Integer DEVICE_WEEK_FAULT_REPEAT = 2;

    public static Integer DEVICE_MONTH_FAULT_REPEAT = 5;

    public static Integer TWO_HOUR = 120;

    /**
     * 设备周状态 良好
     */
    public static Integer GOOD_CONDITION = 1;

    /**
     * 设备运行状态 一般
     */
    public static Integer GENERAL_STATE = 2;

    /**
     * 设备运行状态 不佳
     */
    public static Integer RUN_DOWN = 3;

    /**
     * 设备运行状态 严重不佳
     */
    public static Integer SEVERE_CONDITION_NOT_GOOD = 4;
    /**
     * 1:设备周状态
     */
    public static Integer DEVICE_RUN_STATUS_WEEK_TYPE = 1;
    /**
     * 2:设备月状态
     */
    public static Integer DEVICE_RUN_STATUS_MONTH_TYPE = 2;

    /**
     * 故障次数TOP设备
     */
    public static Integer FAULT_COUNT_TOP_TYPE = 1;
    /**
     * 故障时间超2小时故障次数TOP设备
     */
    public static Integer FAULT_OVER_HOUR_COUNT_TOP_TYPE = 2;
    /**
     * 故障时间TOP设备
     */
    public static Integer FAULT_TOTAL_TIME_TOP_TYPE = 3;



    public static String DATA_FILE_IMAGE_DIR = "resources/static/upload/dataFile/image/";
    public static String DATA_FILE_DIR = "data/dataFile/file/";


    public static void main(String[] args) {
//        byte[] bytes=null;
////        String json = "eyJpZCI6IjIyIiwibmFtZSI6Im5ld0Fk6Zi/5LuA6aG/5Y R5pKS55qEIiwiZGVzY3JpcHRpb24iOiJuZXdBZGQiLCJudW1iZXIiOiJuZXdBZGQiLCJtb2RlbCI6IjQiLCJwcm9kdWNlciI6Im5ld0FkZGVkaXTmlLkiLCJwcm9kdWN0aW9uTGluZSI6IjUiLCJzdGF0dXMiOiIxIn0=";
////        Base64.Decoder decoder = Base64.getDecoder();
////        bytes = decoder.decode(json);
////
////        String value = new String(bytes);
////        System.out.println(value);

        BASE64Decoder decoder = new BASE64Decoder();
        String json = "eyJpZCI6IjIyIiwibmFtZSI6IuS9oOaYr+S4jeaYr+WCu+WtkOWViuaUueaUuSIsImRlc2NyaXB0aW9uIjoibmV3QWRkIiwibnVtYmVyIjoibmV3QWRkIiwibW9kZWwiOiI0IiwicHJvZHVjZXIiOiJuZXdBZGRlZGl05pS5IiwicHJvZHVjdGlvbkxpbmUiOiI1Iiwic3RhdHVzIjoiMSJ9";
        byte[] decoding;
        try {
            decoding = decoder.decodeBuffer(json);
            String value = new String(decoding, StandardCharsets.UTF_8);
            System.out.println(value);
        } catch (IOException e) {
            e.printStackTrace();
        }


    }

}
